﻿Imports Co9320.NamaAlert.ViewModel
Imports Co9320.NamaAlert.Model

Namespace Manager

    Public NotInheritable Class BrowserManager
        Implements ISystemMessageSender

        Public Event SendSystemMessage(ByVal sender As Object, ByVal e As Model.SystemMessageEventArgs) Implements Model.ISystemMessageSender.SendSystemMessage
        Protected Sub OnSendSystemMessage(ByVal e As SystemMessageEventArgs)
            RaiseEvent SendSystemMessage(Me, e)
        End Sub

        Public Shared Sub OpenUri(ByVal uri As Uri, ByVal options As UISettings.BrowserOptionsViewModel)

            Try
                If options.Path IsNot Nothing AndAlso options.Path.Trim <> "" Then
                    Process.Start(options.Path, String.Format(System.Globalization.CultureInfo.CurrentCulture, options.Args.Replace("{url}", uri.ToString)))
                Else
                    Process.Start(uri.ToString)
                End If
            Catch ex As Exception
                ' Ignore
            End Try
        End Sub

    End Class

End Namespace